﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CircuitBreaker
{
    public class ClosedState : CircuitBreakerState
    {
        public ClosedState(CircuitBreaker circuitBreaker)
            : base(circuitBreaker)
        {
            //circuitBreaker.ResetFailureCount();
        }

        public override int ActUponException(Exception e)
        {
            int failures =base.ActUponException(e);
            if (_circuitBreaker.ThresholdReached(failures)) _circuitBreaker.Open();
            return failures;
        }
    }

}
